import requests
import urllib3
from lxml import etree
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'}

url = 'https://lz.esf.fang.com/chushou/3_416752691.htm?channel=2,2'
driver = webdriver.Firefox()
driver.get(url)
# 人工输入验证码
time.sleep(10)

url = f'https://lz.esf.fang.com/house/i31/'




r = requests.get(url, headers=headers, verify=False)
print(r.text)
html = etree.HTML(r.text)

hrefs = html.xpath('//div[@class="shop_list shop_list_4"]/dl/dt/a/@href')
print(hrefs)
channels = html.xpath('//div[@class="shop_list shop_list_4"]/dl/dt/a/@data_channel')
print(channels)
psid = html.xpath('//div[@class="shop_list shop_list_4"]/dl/dt/a/@ps')
print(psid)